/**
 * 
 */
package com.vnetoo.osfilesvr;

import java.io.FileInputStream;
import java.io.InputStream;
import java.net.BindException;
import java.util.Properties;

import javax.swing.JOptionPane;

import org.apache.log4j.xml.DOMConfigurator;

/**
 * @author chenh
 * 视频客户端课件上传
 */
public class RunServer {

	public static String apachefile="/etc/httpd/conf/httpd.conf";
	/**
	 * @param args
	 */
	public static void main(String[] args)throws Exception {		
		Properties prop = new Properties();
		try{
			DOMConfigurator.configure("log4j.xml");
			InputStream is=new FileInputStream("FileSendServer.ini");			
			prop.load(is);			
			System.out.println("start server...");
			apachefile=prop.getProperty("apachefile");
			//new DiskSpace(Integer.parseInt(prop.getProperty("spaceFreq"))).start();
			new FileServer(
					Integer.parseInt(prop.getProperty("port")),
					Integer.parseInt(prop.getProperty("count")),
					Integer.parseInt(prop.getProperty("timeOut")),
					Integer.parseInt(prop.getProperty("fileLog"))!=0);
		}
		catch(BindException ex){
			System.out.println("the server start failed!");
			//JOptionPane.showMessageDialog(null, "the server start failed!");
			ex.printStackTrace();
			return;
		}
		catch(Exception e){
			System.out.println("init log4j error!");
			e.printStackTrace();
			return;
		}
		
	}

}
